package net.lab1024.sa.admin.module.business.erp.bas.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.erp.bas.domain.form.ApptemordaAddForm;
import net.lab1024.sa.admin.module.business.erp.bas.domain.form.ApptemordaQueryForm;
import net.lab1024.sa.admin.module.business.erp.bas.domain.form.ApptemordaUpdateForm;
import net.lab1024.sa.admin.module.business.erp.bas.domain.vo.ApptemordaVO;
import net.lab1024.sa.admin.module.business.erp.bas.service.ApptemordaService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 审批模板细表 Controller
 *
 * @Author AKITA
 * @Date 2025-04-23 09:53:49
 * @Copyright AKITA
 */

@RestController
@Tag(name = "审批模板细表")
public class ApptemordaController {

    @Resource
    private ApptemordaService apptemordaService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/apptemorda/queryPage")

    public ResponseDTO<PageResult<ApptemordaVO>> queryPage(@RequestBody @Valid ApptemordaQueryForm queryForm) {
        return ResponseDTO.ok(apptemordaService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/apptemorda/add")

    public ResponseDTO<String> add(@RequestBody @Valid ApptemordaAddForm addForm) {
        return apptemordaService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/apptemorda/update")
    public ResponseDTO<String> update(@RequestBody @Valid ApptemordaUpdateForm updateForm) {
        return apptemordaService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/apptemorda/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return apptemordaService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/apptemorda/delete/{docEntry}")
    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return apptemordaService.delete(docEntry);
    }
}
